import request from '@/utils/request'

// 获取限制销售策略列表
export function getLimitSaleList (params) {
  return request({
    url: `/control/promotion`,
    method: 'get',
    params: params
  })
}



// 获取 全部 商品
export function allGoodsList (params) {
  return request({
    url: `/goods/goods`,
    method: 'get',
    params: params
  })
}
// 获取 全部 采购商
export function allPurchaserList (params) {
  return request({
    url: `/purchaser/purchaser`,
    method: 'get',
    params: params
  })
}


// 添加   /dev-api/limited/sales
export function addLimitSale (data) {
  return request({
    url: '/control/promotion',
    method: 'post',
    data: data,
  })
}

// 修改  修改控销  /dev-api
export function updLimitSale (id, data) {
  return request({
    url: `/control/promotion/${id}`,
    method: 'put',
    data: data,
  })
}

// 修改限销类型
export function updateType (id, data) {
  return request({
    url: `/control/promotion/${id}/type`,
    method: 'put',
    data: data,
  })
}

// 接收推送的行政区域信息   /dev-api/region/region/list
export function administrativeDivision () {
  return request({
    url: `/region/region/list`,
    method: 'get',
  })
}

//  删除
export function delLimitSale (id) {
  return request({
    url: `/control/promotion/${id}`,
    method: 'delete',
  })
}

// 根据货品id删除控销配置
export function deleteLimitItem (skuId) {
  return request({
    url: '/control/promotion/batch/' + skuId,
    method: 'delete',
  })
}


// 获取控销配置详情
export function getLimitItem (id) {
  return request({
    url: '/control/promotion/' + id,
    method: 'get',
  })
}

